package com.yanqu.road.logic.sort.yrank;

import com.yanqu.road.entity.rank.yrank.UnionYRank;

import java.util.Comparator;
import java.util.Objects;

public class UnionYRankSort implements Comparator<UnionYRank> {

    @Override
    public int compare(UnionYRank o1, UnionYRank o2) {
        if (!Objects.equals(o1.getValue(), o2.getValue())) {
            return o2.getValue().compareTo(o1.getValue());
        }
        return Long.compare(o1.getUpdateTime(), o2.getUpdateTime());
    }

}
